Hello,
pragma runLim, 0
DB dbDialog
DBE FQModule, FJSModule, dbeSubmit
Skip fGetSelectedObjects(Module in_mod)
{ // Function source IBM DXL forum
// Return a Skip List of objects that are currently selected in the module.
// 'Selected' means either a range of objects or the currently selected single object.
// Return an empty skip list when there are no selected objects
// Calling program should delete the Skip when finished.
Skip skpObjects = create() // Return KEY and DATA both 'Object'
if (null in_mod) return(skpObjects)
Object oCurr = current,o
for o in entire (in_mod) do
{
if (isDeleted(o)) continue
if (isSelected(o) or o == oCurr) {put(skpObjects, o, o)}
}
return(skpObjects)
} // end fGetSelectedObjects()
void outLinks(Object fromObj)
{
// scan outgoing links
Link l
ModName_ otherMod = null
ModuleVersion otherVersion = null
Object othero = null
const string linkModName = "*"
string objText = null
string Comments = null
for l in all(fromObj->linkModName) do
{
if(name(module(l)) != "child2parent" && name(module(l)) != "parent2child") continue
if(name(module(l)) == "parent2child")
{Comments = get(FQModule)}else{Comments = get(FJSModule)}
otherVersion = targetVersion l
otherMod = module(otherVersion)
if (null otherMod || isDeleted otherMod) continue
othero = target l
if (null othero) {load(otherVersion,false)}
if (null othero) continue
if (isDeleted othero) continue
if(null (richTextWithOle fromObj."_Comments"))
{objText = (richTextWithOle fromObj."_Comments") Comments}
else
{objText = (richTextWithOle fromObj."_Comments") "\n" Comments}
fromObj."_Comments" = richText objText
delete l
// flush out the deleted links
flushDeletions()
refresh(module(fromObj))
}
}
void inLinks(Object fromObj)
{
// scan incoming links
Link l
LinkRef lr
ModName_ otherMod = null
ModuleVersion otherVersion = null
Object othero = null
const string linkModName = "*"
string objText = null
string Comments = null
for lr in all(fromObj<-linkModName) do
{
otherMod = module (sourceVersion lr)
if (!null otherMod)
{if ((!isDeleted otherMod) && (null data(sourceVersion lr))) {load((sourceVersion lr),false)}}
}
for l in all(fromObj<-linkModName) do
{
if(name(module(l)) != "child2parent" && name(module(l)) != "parent2child") continue
if(name(module(l)) == "child2parent")
{Comments = get(FJSModule)}else{Comments = get(FQModule)}
otherVersion = sourceVersion l
otherMod = module(otherVersion)
if (null otherMod || isDeleted otherMod) continue
othero = source l
if (null othero) {load(otherVersion,false)}
if (null othero) continue
if (isDeleted othero) continue
Module inlink = edit(fullName(module(othero)),true, true)
if (!null inlink)
{
if(null (richTextWithOle othero."_Comments"))
{objText = (richTextWithOle othero."_Comments") Comments}
else
{objText = (richTextWithOle othero."_Comments") "\n" Comments}
othero."_Comments" = richText objText
delete l
// flush out the deleted links
flushDeletions()
refresh(module(othero))
}else {ack "{ Null parameter} "fullName(module(othero))}
}
}
void selection()
{
Skip skpObjects = fGetSelectedObjects(current Module)
Object o
for o in skpObjects do
{ // deal with the selected o
inLinks(o)
outLinks(o)
}
delete(skpObjects)
}
void main(DB dbeXX)
{
string FQ = get(FQModule)
string FJS = get(FJSModule)
if(null FQ || null FJS)
{ack "{NULL} User must enter comments!"}
else
{
selection()
set(FQModule, "")
set(FJSModule, "")
}
}
dbDialog = create "Delete pairing..."
FQModule = richText(dbDialog, "FQ Module: ", "", 100, false)
FJSModule = richText(dbDialog, "FJS Module: ", "", 100, false)
dbeSubmit = apply(dbDialog, "Submit", main)
realize dbDialog
show dbDialog
SystemAdmin - Fri Apr 27 10:23:08 EDT 2012 |